﻿@model UserSettingsModel
@using Urs.Data.Domain.Users 
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">目录设置</div>
                <div class="layui-card-body">
                    <div class="layui-form" wid200 lay-filter="">
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.UserRegistrationType" />
                            <div class="layui-input-inline">
                                <u-select asp-for="UserSettings.UserRegistrationType" asp-items="@(((UserRegistrationType)Model.UserSettings.UserRegistrationType).ToSelectList())" />
                                <span asp-validation-for="UserSettings.UserRegistrationType"></span>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.AllowUsersToUploadAvatars" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.AllowUsersToUploadAvatars" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.DefaultAvatarEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.DefaultAvatarEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.UserNameFormat" />
                            <div class="layui-input-inline">
                                <u-select asp-for="UserSettings.UserNameFormat" asp-items="@(((UserNameFormat)Model.UserSettings.UserNameFormat).ToSelectList())" />
                                <span asp-validation-for="UserSettings.UserNameFormat"></span>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.DefaultPasswordFormat" />
                            <div class="layui-input-inline">
                                <u-select asp-for="UserSettings.DefaultPasswordFormat" asp-items="@(((PasswordFormat)Model.UserSettings.DefaultPasswordFormat).ToSelectList())" />
                                <span asp-validation-for="UserSettings.DefaultPasswordFormat"></span>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.AcceptPrivacyPolicyEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.AcceptPrivacyPolicyEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="ExternalAuthenticationSettings.AutoRegisterEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="ExternalAuthenticationSettings.AutoRegisterEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="BillingAddressSettings.BillingEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="BillingAddressSettings.BillingEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.GenderEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.GenderEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.DateOfBirthEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.DateOfBirthEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.CompanyEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.CompanyEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.CompanyRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.CompanyRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.StreetAddressEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.StreetAddressEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.StreetAddressRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.StreetAddressRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.StreetAddress2Enabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.StreetAddress2Enabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.StreetAddress2Required" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.StreetAddress2Required" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.ZipPostalCodeEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.ZipPostalCodeEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.ZipPostalCodeRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.ZipPostalCodeRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.ProvincesEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.ProvincesEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.PhoneEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.PhoneEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.PhoneRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.PhoneRequired" />
                                <span asp-validation-for="UserSettings.PhoneRequired"></span>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.FaxEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.FaxEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.FaxRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.FaxRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="UserSettings.NewsletterEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="UserSettings.NewsletterEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.CompanyEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.CompanyEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.CompanyRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.CompanyRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.StreetAddressEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.StreetAddressEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.StreetAddressRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.StreetAddressRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.StreetAddress2Enabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.StreetAddress2Enabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.StreetAddress2Required" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.StreetAddress2Required" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.ZipPostalCodeEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.ZipPostalCodeEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.ZipPostalCodeRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.ZipPostalCodeRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.ProvincesEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.ProvincesEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.PhoneEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.PhoneEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.PhoneRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.PhoneRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.FaxEnabled" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.FaxEnabled" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <u-label asp-for="AddressSettings.FaxRequired" />
                            <div class="layui-input-inline">
                                <u-bool asp-for="AddressSettings.FaxRequired" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="set_system_submit_btn">确认保存</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'set'], function () {
        var $ = layui.$
            , form = layui.form
            ,active = {
            test: function () {
                layer.open({
                    type: 2
                    , title: '系统信息'
                    , content: ''
                    , area: ['400px', '300px']
                    , btn: ['确定', '取消']
                    , yes: function (index, layero) {
                        //点击确认触发 iframe 内容中的按钮提交
                        var submit = layero.find('iframe').contents().find("#layuiadmin-app-form-submit");
                        submit.click();
                    }
                });
            }
            }
        form.on('submit(set_system_submit_btn)', function (obj) {
          var field = obj.field;
            $.post('@Url.Action("UserUser")', field, function (rep) {
                if (rep.success == 1) {
                    layer.msg('保存成功');
                }
            });
            return false;
    });
        $('.layui-btn.layuiadmin-btn-tags').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

    });

</script>